package edu.nuc.event.service;

import edu.nuc.event.dao.UserMapper;
import edu.nuc.event.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

    @Autowired
    UserMapper userMapper;

    public List<User> getAllUser() {
        List<User> users = userMapper.getAllUsers();
        return users;
    }

    public List<User> demandusers(int cpid, int usertype) {
        //System.out.println(cpid+"-----------"+usertype);
        List<User> users = userMapper.demandusers(cpid, usertype);
        // System.out.println(users);
        return users;
    }

    public int demanduseraccount(@Param("cpid") Integer cpid, @Param("usertype") Integer usertype) {

        int account = userMapper.demanduseraccount(cpid, usertype);
        //System.out.println(account);
        return account;
    }

    public List<User> comemptyuser(int usertype) {
        List<User> users = userMapper.comemptyuser(usertype);
        // System.out.println("------赛事用户---------"+users);
        return users;
    }

    public int comemptyuseraccount(Integer usertype) {
        int account = userMapper.comemptyuseraccount(usertype);
        return account;
    }

    public int updateusercp(int userid, int comid) {
        int i = userMapper.updateusercp(userid, comid);
        return i;
    }

    public int updateusercpisnull(int userid) {
        int i = userMapper.updateusercpisnull(userid);
        return i;
    }

    public int updateuser(User user) {
        int i = userMapper.updateuser(user);
        return i;
    }

    public List<User> findusers(int usertype) {
        List<User> userList = userMapper.findusers(usertype);
        return userList;
    }

    public int adduser(User user) {
        int i = userMapper.adduser(user);
        return i;
    }

    public int selectByuseraccount(int useraccount) {
        int id = userMapper.selectByuseraccount(useraccount);
        return id;
    }


}
